import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  UseGuards,
} from '@nestjs/common';
import { RallyRuleService } from './rally-rule.service';
import { CreateRallyRuleDto } from './dto/create-rally-rule.dto';
import { UpdateRallyRuleDto } from './dto/update-rally-rule.dto';
import { ApiBearerAuth } from '@nestjs/swagger';
import { Auth } from 'src/common/decorators/auth.decorator';



@Auth()
@ApiBearerAuth()
@Controller('rally-rule')
export class RallyRuleController {
  constructor(private readonly rallyRuleService: RallyRuleService) {}

  @Post()
  create(@Body() createRallyRuleDto: CreateRallyRuleDto) {
    return this.rallyRuleService.create(createRallyRuleDto);
  }

  @Get('list')
  findAll() {
    return this.rallyRuleService.findAll();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.rallyRuleService.findOne(+id);
  }

  @Patch(':id')
  update(
    @Param('id') id: string,
    @Body() updateRallyRuleDto: UpdateRallyRuleDto,
  ) {
    return this.rallyRuleService.update(+id, updateRallyRuleDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.rallyRuleService.remove(+id);
  }
}
